/**
 * Created with JetBrains PhpStorm.
 * User: sergey.uchvatov
 * Date: 03.12.12
 * Time: 12:33
 * To change this template use File | Settings | File Templates.
 */
jQuery(document).ready(function($){
    // remove my default click handlers, so that links are followed...
    $('#mac-menu a').unbind('click');
    // set up the options to be used for jqDock...
    var dockOptions =
    {   size : 80,          //[px] maximum minor axis dimension (when at rest) of image (width or height depending on 'align' : vertical menu = width, horizontal = height)
        sizeMax : 120,        //[px] maximum minor axis dimension of a fully-expanded image (width or height depending on 'align' : vertical menu = width, horizontal = height)
        capSizing : 0,      //changes the calculation of maximum minor axis dimensions (size and sizeMax options) from absolute (ie. regardless of whether the value is less than or greater than the option value) to a cap (ie. only if greater than); default is absolute
        distance : 160,      //[px] attenuation distance from cursor
        coefficient : 1.5,  //attenuation coefficient
        duration : 300,     //[ms] duration of initial expansion and off-menu shrinkage
        align : 'middle',   //[top/middle/bottom or left/center/right] fixes horizontal/vertical expansion axis
        labels : true,         //enable/disable display of a label on the current image; (true) to use default position, or string to specify
        source : 0,         //function: given scope of relevant image element; passed index of image within menu; required to return image source path, or false to use original
        loader : 0,         //overrides useJqLoader if set to 'image' or 'jquery'
        inactivity : 0,     //[ms] duration of inactivity (no mouse movement) after which any expanded images will collapse; 0 (zero) disables the inactivity timeout
        fadeIn : 200,         //[ms] duration of the fade-in 'reveal' of the jqDocked menu; set to zero for instant 'show'
        fadeLayer : '',     //if fadeIn is set, this can change the element that is faded; the default is the entire original menu; alternatives are 'wrap' (.jqDockWrap element) or 'dock' (.jqDock element)
        step : 50,          //[ms] the timer interval between each step of shrinkage/expansion
        setLabel : false,       //function for transforming label text (ie. title) when initially building the label;
        //  this is provided so that if the label requires HTML, the transform function can set
        //  it rather than having to put it in the title field and thereby make the markup invalid.
        //  the called function will be given the scope (this) of the original menu element, and will be
        //  passed 4 arguments:
        //   - the derived default text of the label (from the title of either the image or its parent anchor)
        //   - the (zero-based) index of the option within the menu
        //   - the outer DOM element of the target label, div.jqDockLabel
        //   - an array of HTML for creating the inner label container, div.jqDockLabelText (['<div class="jqDockLabelText">', '</div>'])
        //  the function should return either
        //   - the HTML string for the label, in which case jqDock will create the inner container and append the returned text to it
        //   - or false, in which case jqDock will do nothing further with the label setup
        flow : 0,           //alters the default dock behaviour such that the dock is NOT auto-centered and the wrap
        //  element (.jqDockWrap, which a relatively positioned) expands and collapses to precisely
        //  contain the dock (.jqDock); this allows elements positioned around the docked menu to
        //  adjust their own relative position according to the current state of the docked menu
        idle : 0,           //[ms] duration of idle time after the mouse has left the menu (without re-entering, obviously!) before the docksleep event is triggered (on the original menu element)
        onReady : 0,        //function: called with scope of original menu element when dock has been initialised but not yet revealed (ie. before being shown)
        //  NB: the onReady() function is passed a single argument, 'ready', and can return false to cancel the 'reveal' of the menu and put the dock to sleep
        onSleep : 0,        //function: called with scope of original menu element when dock has been idle for the defined idle period and has therefore gone to sleep,
        //  or when either a sleep or freeze has been requested by the calling script (by triggering dockidle/dockfreeze, or commanding idle/freeze)
        //  NB: the onSleep() function is passed a single argument, 'sleep' or 'freeze', and can return false to cancel the sleep/freeze
        onWake : 0,         //function: called with scope of original menu element when dock is 'nudged' awake, but only triggered if the dock was asleep (incl. frozen) prior to the' nudge'
        //  NB: the onWake() function is passed a single argument, 'wake' or 'thaw', and can return false to cancel the wake-up (dock stays asleep/frozen)
        noBuffer : 0,       //disables the buffering of the last mouse event while the dock is asleep
        active : -1,        //index (zero-based) of the image required to be expanded on initial display
        bias : 50,          //percentage expansion (range 0-100) on the *leading* edge side, for middle and center aligned
        //  expansion, providing a biased expansion instead of 50/50 from the mid-point
        //  NB: align:middle,bias:0 === align:top, and align:middle,bias:100 === align:bottom
        //  and vertically, align:center,bias:0 === align:left, and align:center,bias:100 === align:right
        noAntiFlutter : 0   //allows disabling/bypassing of the oscillation checking in SET_SIZES()
    };
    // ...and apply...
    $('#mac-menu').jqDock(dockOptions);
});